package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.CourseBaseDTO;
import com.xuecheng.api.content.model.vo.CourseAuditVO;
import com.xuecheng.api.content.model.vo.CourseBaseVO;
import com.xuecheng.content.entity.CourseBase;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * - @author by 姜暄煊
 * - @Date 12.8
 * - @Description
 */
@Mapper
public interface CourseBaseConvert {

    CourseBaseConvert INSTANCE = Mappers.getMapper(CourseBaseConvert.class);

    //将po转为dto数据
    //注解转换id名称 其他字段一致
    @Mapping(target = "courseBaseId",source = "id")
    CourseBaseDTO entity2dto (CourseBase courseBase);


    //增加课程在业务中需要把dto转为po数据
    @Mapping(target = "id",source = "courseBaseId")
    CourseBase dtoEntity2to (CourseBaseDTO dto);
    ////增加课程在业务中需要把vo转为dto数据
    @Mapping(target = "courseBaseId",source = "courseBaseId")
    CourseBaseDTO voEntity2 (CourseBaseVO courseBaseVO);

    CourseBaseDTO vo2toDto (CourseAuditVO auditVO);

    //集合模式需要建立在单个的上面
    List<CourseBaseDTO> entitys2dtos(List<CourseBase> courseBases);
}
